package cn.meomis.action;

import java.text.SimpleDateFormat;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

//@Scope("prototype") 
@Controller
//@Namespace("/")
@ParentPackage("json-default")
//@Result(name="success", type="json")
public class DemoAction extends BaseAction {

	private static final long serialVersionUID = 1L;
	private SimpleDateFormat dateformat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	
	@Action(value = "/demoLoginAction", results = { @Result(name = SUCCESS, location = "/cheAction.action", type = "redirect" ),
													@Result(name = "login", location = "/login.jsp" )})
	public String login() {
		String username = httpServletRequest.getParameter("username");
		String password = httpServletRequest.getParameter("password");
		if("admin".equals(username) && "admin".equals(password)){
			return SUCCESS;
		}else{
			return "login";
		}
	}
	
	
}
